package com.afeng.api.module.schedule;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 使用quartz执行定时器
 **/
@Component
@EnableScheduling
@ConditionalOnProperty(prefix = "afeng", name = "scheduleEnabled", havingValue = "true")
public class QuartzTest {

    /**
     * 设置每2秒执行一次
     **/
    @Scheduled(cron = "0/2 * * * * ?")
    public void testTimer() {
        System.err.println("#########");
        System.err.println("#########");
        System.err.println("#########");
        System.err.println("#########");
        System.err.println("#########");
    }

}
